package cpm.itheima;

import com.alibaba.druid.pool.DruidDataSource;
import cpm.itheima.controller.UserController;
import cpm.itheima.dao.UserDao;
import cpm.itheima.models.User;
import javafx.application.Application;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;

@Configuration
public class SpringApplication {
    public static void main(String[] args) {
        ApplicationContext applicationContext =new ClassPathXmlApplicationContext("applicationContext.xml");
        UserDao userDao =(UserDao) applicationContext.getBean("userDao");
        System.out.println(userDao);
        UserController userController = (UserController)applicationContext.getBean("userController");
        System.out.println(userController);
        DruidDataSource dataSource =(DruidDataSource)applicationContext.getBean("dataSource");
        System.out.println(dataSource);
    }
}
